<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="app" uri="http://www.wanrenhui.com" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
	  <%@include file="/res/include/base-head.jsp"%>
	  <%@include file="/res/include/jquery-easyui.jsp"%>
	<script type="text/javascript" src="${pageContext.request.contextPath}/res/js/homemaking/homemakingBase.js"></script>
  </head>
  <body>
	<div class="easyui-layout" data-options="fit:true">
		<div data-options="region:'north',border:false,split:false">
	    	<form id="query-form" class="search_form clearfix">
				<dl>
	                <dt>类别：</dt>
	                <dd>
	                	<select name="firstTypeId" class="txt grid-10">
	                		<option value="">--请选择--</option>
	                		<c:forEach var="typeVo" items="${typeList}">
	                			<option value="${typeVo.id }">${typeVo.name }</option>
	                		</c:forEach>
	                	</select>
	                </dd>
	            </dl>
	            <dl>
	                <dt>审核状态：</dt>
	                <dd>
	                	<select name="auditStatus" class="txt">
	                		<option value="">--请选择--</option>
	                		<option value="1">未审核</option>
	                		<option value="2">已审核</option>
	                		<option value="3">不通过</option>
	                	</select>
	                </dd>
	            </dl>
	            <p class="search_form_btn">
	            	<input type="button" value="搜索" class="icon_serach" onclick="admin.homemakingBase.query()" />
	            </p>
	        </form>
	  	</div>
	    <div data-options="region:'center',border:false">
		    <table id="datagrid" data-options="url:'${pageContext.request.contextPath}/homemaking/base/list',toolbar:'#toolbar'">
				<thead>
					<tr>
						<th data-options="field:'typeStr',width:80,align:'center' ">类别</th>
						<th data-options="field:'name',width:300,align:'center'">技能描述</th>
						<th data-options="field:'nick',width:100,align:'center' ">创建人昵称</th>
						<th data-options="field:'realName',width:100,align:'center' ">创建人</th>
						<th data-options="field:'communityName',width:100,align:'center' ">所属社区</th>
						<th data-options="field:'statusStr',width:80,align:'center' ">接单状态</th>
						<th data-options="field:'auditStatus',width:80,align:'center',formatter:formatAuditStatus">审核状态</th>
						<th data-options="field:'orderedCount',width:80,align:'center'">预约人数</th>
						<th data-options="field:'isShowStr',width:80,align:'center'">是否显示</th>
						<th data-options="field:'todoOrderCount',width:80,align:'center'">未完成的预约</th>
			            <th data-options="field:'id',align:'center',width:400,formatter:formatOperation">操作</th>
					</tr>
				</thead>
			</table>
	  	</div>
	</div>

	<script>
		function formatAuditStatus(value,row,index) {
			var l_html = '待审核';
			if (value == 2) {
				l_html = '审核通过';
			} else if (value == 3) {
				l_html = '审核不通过';
			}
			return l_html;
		}
		function formatOperation(value,row,index) {
			var l_html = '';
			l_html += '<a href="javascript:;" class="table_link" onclick="admin.homemakingBase.detail('+row.id+')">查看详情</a>';
			l_html += '|<a href="javascript:;" class="table_link" onclick="admin.homemakingBase.orderList('+row.id+',\''+row.nick+'\')">查看预约</a>';
			if (row.typeId == 16) {
				l_html += '|<a href="javascript:;" class="table_link" onclick="admin.homemakingBase.timeList('+row.id+',\''+row.nick+'\')">上班时间</a>';
			} else {
				l_html += '|<a href="javascript:;" class="table_link" onclick="admin.homemakingBase.timeList('+row.id+',\''+row.nick+'\')">休息时间</a>';
			}
			if (row.status == 1) {
				l_html += '|<a href="javascript:;" class="table_link" onclick="admin.homemakingBase.setStatus('+row.id+',2)">暂停接单</a>';
			} else {
				l_html += '|<a href="javascript:;" class="table_link" onclick="admin.homemakingBase.setStatus('+row.id+',1)">开启接单</a>';
			}
			/*
			if (row.auditStatus == 2) {
				l_html += '|<a href="javascript:;" class="table_link" onclick="admin.homemakingBase.setAuditStatus('+row.id+',3)">审核不通过</a>';
			} else {
				l_html += '|<a href="javascript:;" class="table_link" onclick="admin.homemakingBase.setAuditStatus('+row.id+',2)">审核通过</a>';
			}*/
			
			return l_html;
		}
	</script>
  </body>
</html>
